/**
* Created by ren on 2017/1/6.
*/
<template>
  <div class='safeMain'>
    <template v-if="_parentThis.safeChild==='parent'">
      <div style="margin:20px;border-bottom: 1px solid #cccccc;padding-bottom: 20px">
        <div style="margin-bottom: 10px">账户名称：{{this.$cookie.get('mobile')}}</div>
        <div>账户注册时间：{{this.$cookie.get('createTime')}}</div>
      </div>
      <div class="item" @click="cut('addressList')">
        <span>地址管理</span><img src="../../assets/toright.png" alt="">
      </div>
      <div class="item" @click="cut('loginPwd')">
        <span>登录密码管理</span><img src="../../assets/toright.png" alt="">
      </div>
      <div class="item" @click="cut('bankList')">
        <span>银行卡管理</span><img src="../../assets/toright.png" alt="">
      </div>
      <div class="item" @click="cut('pwdManage')">
        <span>支付管理</span><img src="../../assets/toright.png" alt="">
      </div>
    </template>
    <template v-if="_parentThis.safeChild==='addressList'">
      <AddressList :_parentThis="_parentThis"></AddressList>
    </template>
    <template v-if="_parentThis.safeChild==='updateAddress'">
      <UpdateAddress :_parentThis="_parentThis"></UpdateAddress>
    </template>
    <template v-if="_parentThis.safeChild==='createAddress'">
      <CreateAddress :_parentThis="_parentThis"></CreateAddress>
    </template>
    <template v-if="_parentThis.safeChild==='loginPwd'">
      <LoginPwd :_parentThis="_parentThis"></LoginPwd>
    </template>
    <template v-if="_parentThis.safeChild==='bankList'">
      <BankList :_parentThis="_parentThis"></BankList>
    </template>
    <template v-if="_parentThis.safeChild==='pwdManage'">
      <PwdManage :_parentThis="_parentThis"></PwdManage>
    </template>
    <template v-if="_parentThis.safeChild==='updatePayPwd'">
      <UpdatePayPwd :_parentThis="_parentThis"></UpdatePayPwd>
    </template>
    <template v-if="_parentThis.safeChild==='resetPayPwd'">
      <ResetPayPwd :_parentThis="_parentThis"></ResetPayPwd>
    </template>
    <template v-if="_parentThis.safeChild==='addBank'">
      <AddBank :_parentThis="_parentThis"></AddBank>
    </template>
  </div>
</template>

<script>
  import AddressList from './AddressList'
  import UpdateAddress from './UpdateAddress'
  import CreateAddress from './CreateAddress'
  import LoginPwd from './LoginPwd'
  import PwdManage from './PwdManage'
  import BankList from './BankList'
  import AddBank from './AddBank'
  import UpdatePayPwd from './UpdatePayPwd'
  import ResetPayPwd from './ResetPayPwd'
  export default {
    name: 'safeMain',
    props: ['_parentThis'],
    components: {
      AddressList,
      UpdateAddress,
      LoginPwd,
      PwdManage,
      BankList,
      AddBank,
      UpdatePayPwd,
      ResetPayPwd,
      CreateAddress
    },
    data: function () {
      return {}
    },
    methods: {
      cut: function (name) {
        this._parentThis.safeChild = name
        switch (name) {
          case 'parent':
            this._parentThis.titHtml = '<span>信息安全</span>'
            break
          case 'addressList':
            this._parentThis.titHtml = '<span>信息安全 > <span style="color: #f48315;">地址管理</span></span>'
            break
          case 'loginPwd':
            this._parentThis.titHtml = '<span>信息安全 > <span style="color: #f48315;">登录密码管理</span></span>'
            break
          case 'pwdManage':
            this._parentThis.titHtml = '<span>信息安全 > <span style="color: #f48315;">支付管理</span></span>'
            break
          case 'bankList':
            this._parentThis.titHtml = '<span>信息安全 > <span style="color: #f48315;">银行卡管理</span></span>'
            break
          case 'addBank':
            this._parentThis.titHtml = '<span>信息安全 > <span>银行卡管理</span> > <span style="color: #f48315;">添加银行卡</span></span>'
            break
          case 'updatePayPwd':
            this._parentThis.titHtml = '<span>信息安全 > <span>支付管理</span> > <span style="color: #f48315;">修改支付密码</span></span>'
            break
        }
      }
    },
    mounted: function () {
      this._parentThis.cutName = 'safe'
      if (this.$cookie.get('initpwd') === 'true') {
        this.cut('resetPayPwd')
        this.$cookie.delete('initpwd')
      }
      if (this.$cookie.get('customHandle')) {
        this.cut(this.$cookie.get('customHandle'))
        this.$cookie.delete('customHandle')
      }
    }
  }
</script>
